#include <iostream>
#include "DiagramBlock.h"
#include "ConstantInt.h"
#include "PrimitiveBinOp.h"
#include "Control.h"
#include "DiagramInline.h"

using namespace std;

int main (int argc, char *argv[])
{

  cout << "Starting..." << endl;

  DiagramBlock block("main", true);
  DiagramInline* in= new DiagramInline(&block);
  in->addSink();
  in->addSink();
  in->addSource();
  
  Control* control = new Control(&block, true);
  Control* indicator = new Control(&block, false);
  ConstantInt* fortySeven = new ConstantInt(&block,32,47,true);
  PrimitiveBinOp* add = new PrimitiveBinOp(in,PrimitiveBinOp::Add);
  fortySeven->connectSourceTo(in,0,0);
  control->connectSourceTo(in,0,1);
  in->connectSourceTo(add,0,0);
  in->connectSourceTo(add,1,1);
  in->connectSourceTo(indicator,2,0);
  add->connectSourceTo(in,2,2);
  block.add(fortySeven);
  in->add(add);
  block.add(control);
  block.add(indicator);
  block.add(in);
  llvm::Module* mod = block.process();
  mod->dump();
  delete mod;
  
  cout<<"Complete"<<endl;
  return 0;
}

